package Statistics;

/**
 * Specifies how the crit attribute will act.
 * @author Hetalar
 * 07/02/2012 
 */
public class Crit extends Stat
{	
	private static final String STAT_NAME = "CRIT";
	private static final int STAT_ALTER = Statistics.STAT_CRIT_RATE;
	
	public Crit(Statistics stat, int startingValue)
	{
		super(stat, startingValue, STAT_NAME, Statistics.STAT_CRIT);
	}
	
	public Crit(Statistics stat)
	{
		super(stat, 0, STAT_NAME, Statistics.STAT_CRIT);
	}
	
	protected void applyStat(double oldValue)
	{
		double change = oldValue - value;
																						
		if(change != 0)
		{
			this.statistic.increaseStat(STAT_ALTER, 
					Coefficients.calcCritRateChange(change, statistic));
		}
	}
}
